package com.ledou44.apollolearn.controller;

import com.alibaba.fastjson.JSON;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import com.ledou44.apollolearn.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableApolloConfig
public class LoginController {

    /**
     * 注入config 相当于 ConfigService.getAppConfig() 获取默认命名空间配置信息
     */
    @ApolloConfig
    private Config config;

    @Autowired
    private UserMapper userMapper;

    @GetMapping("/get")
    public String get() {
        return JSON.toJSONString(userMapper.select());
    }

}
